<?php
require_once BASEPATH."application/news/models/News.php";

class News_IndexController extends Zend_Controller_Action
{
	public function postDispatch()
    {
		$this->view->content = $this->view->render("{$this->request["controller"]}/{$this->request["action"]}.phtml") ;

		if($this->request["output"] != "html")
		{
	        $response = $this->getResponse();

	        $view = new Zend_View();
			$view->content = $this->view->content;
			$view->setBasePath( BASEPATH . 'application/default/views/');
			
	        $response->setBody($view->render('index/index.phtml'));
		}
    }

	public function init()
	{
		$this->request = $this->getRequest()->getParams();

	}

	public function indexAction()
	{
		$this->render();
	}

	public function listAction()
	{
		$news = new News();

		$this->view->newsList = $news->listt();

		$this->render();
	}

	public function showAction()
	{
		$news = new News();

		$this->view->news = $news->find($this->request["id"]);

		$this->render();
	}

}
?>
